<template>
  <div id="name">
    <div class="wl-body">
      <div class="top"></div>
      <div class="topbox slideOut">
        <div class="bdds slideOut">
          <div class="txtsde txtc t-left">{{ $t("m.jtsy") }}</div>
          <div class="link-item bottml">
            <div class="zc-dj t-left">USDT</div>
            <div class="slink defcf">
              <div class="flex1">{{ $t("m.ky") }}</div>
              <div class="flex1">{{ $t("m.zh") }}({{ bzdw }})</div>
            </div>
            <div class="slink u-dj">
              <div class="flex1"></div>
              <div class="flex1"></div>
            </div>
          </div>
        </div>
      </div>
      <div>
        <div class="i-title t-left mtp">— {{ $t("m.jllb") }} —</div>
        <div class="mtp slink w30 xuankuang">
          <div
            class="xk1l scllow"
            :class="[acchange == 0 ? 'active' : '']"
            @click="changers(0)"
          >
            {{ $t("m.qb") }}
          </div>
          <div
            class="xk1 scllow"
            :class="[acchange == 1 ? 'active' : '']"
            @click="changers(1)"
          >
            USDT
          </div>
        </div>
      </div>

      <div class="bdds slideIn" v-if="show">
        <van-list
          v-model="loading"
          :finished="finished"
          :finished-text="$t('m.nomore')"
          @load="onLoad"
        >
          <div class="link-item bottml" v-for="(item, k) in lslist" :key="k">
            <div class="slink defcf">
              <div class="flex1">{{ $t("m.sl") }}</div>
              <div class="flex1">{{ $t("m.bz") }}</div>
              <div class="flex1">{{ $t("m.sj") }}</div>
            </div>
            <div class="slink u-dj">
              <div class="flex1">{{ item.price }}</div>
              <div class="flex1">
                {{
                  item.currency == 1 ? "USDT" : item.currency == 2 ? "TROT" : ""
                }}
              </div>
              <div class="flex1">{{ item.createDate }}</div>
            </div>
          </div>
        </van-list>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "name",
  data() {
    return {
      isPublish: false,
      acchange: 0,
      show: true,
      s: "",
      see: "",
      lslist: [],
      loading: false,
      finished: false,
      pageNum: 1,
    };
  },
  created() {
    this.s = JSON.parse(sessionStorage.getItem("s"));
    if (this.$store.getters.see == "0") {
      this.see = false;
    } else {
      this.see = true;
    }
  },
  computed: {
    ttoc() {
      return this.$store.getters.ttoc;
    },
    utoc() {
      return this.$store.getters.utoc;
    },
    ttou() {
      return this.$store.getters.ttou;
    },
    bzdw() {
      if (this.$store.getters.language == "zh-CN") {
        return "CNY";
      } else {
        return "USD";
      }
    },
  },
  methods: {
    guanbi() {
      this.$router.go(-1);
    },
    changers(val) {
      this.acchange = val;
      this.show = false;
      this.lslist = [];
      this.pageNum = 1;
      this.onLoad();
    },
    onLoad() {
      this.loading = false;
      // if (this.$store.getters.nameid) {
      //   var datas = {
      //     params: {
      //       uid: this.$store.getters.nameid,
      //       pageSize: 10,
      //       pageNum: this.pageNum,
      //       type: 1,
      //       currency: this.acchange,
      //       direct: 2,
      //     },
      //   };
      //   this.$get({
      //     url: "ums-community-history/getList",
      //     data: datas,
      //     callback: (data) => {
      //       this.$nextTick(function () {
      //         var list = data.data;
      //         if (list) {
      //           this.show = true;
      //           if (this.pageNum > 1) {
      //             this.lslist = [...this.lslist, ...list];
      //           } else {
      //             this.lslist = list;
      //           }
      //           this.loading = false;
      //           if (list.length != 0) {
      //             this.pageNum++;
      //           } else {
      //             this.finished = true;
      //           }
      //         }
      //       });
      //     },
      //   }).catch(() => {
      //     this.$toast(this.$i18n.t("m.errordata"));
      //   });
      // } else {
      //   this.getuid();
      // }
    },
    getuid() {
      this.$get({
        url: "wms-wallet/user-game-info/" + this.$store.getters.userWallet,
        data: {},
        callback: (data) => {
          this.$nextTick(function () {
            if (data.data) {
              this.$store.commit("nameid", data.data.id);
              this.onLoad();
            }
          });
        },
      }).catch(() => {
        this.$toast(this.$i18n.t("m.errordata"));
      });
    },
  },
  watch: {
    "$store.getters.see": function (e) {
      //你需要执行的代码
      console.log(e);
      if (e == 0) {
        this.see = false;
      } else {
        this.see = true;
      }
    },
  },
};
</script>

<style lang="scss" scoped>
</style>